<?php
class ModelCatalogsyScontent extends Model {
	public function getSyscontent($syscontent_id) {
		$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "syscontent i LEFT JOIN " . DB_PREFIX . "syscontent_description id ON (i.syscontent_id = id.syscontent_id) LEFT JOIN " . DB_PREFIX . "syscontent_to_store i2s ON (i.syscontent_id = i2s.syscontent_id) WHERE i.syscontent_id = '" . (int)$syscontent_id . "' AND id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1'");
	
		return $query->row;
	}
	
	public function getSyscontents() {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "syscontent i LEFT JOIN " . DB_PREFIX . "syscontent_description id ON (i.syscontent_id = id.syscontent_id) LEFT JOIN " . DB_PREFIX . "syscontent_to_store i2s ON (i.syscontent_id = i2s.syscontent_id) WHERE id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' AND i.sort_order <> '-1' ORDER BY i.sort_order, LCASE(id.title) ASC");
		
		return $query->rows;
	}
	public function getSyscontentsByName($syscontent_name) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "syscontent i LEFT JOIN " . DB_PREFIX . "syscontent_description id ON (i.syscontent_id = id.syscontent_id) LEFT JOIN " . DB_PREFIX . "syscontent_to_store i2s ON (i.syscontent_id = i2s.syscontent_id) WHERE id.title LIKE '" . $syscontent_name . "' AND id.language_id = '" . (int)$this->config->get('config_language_id') . "' AND i2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND i.status = '1' AND i.sort_order <> '-1' ORDER BY i.sort_order, LCASE(id.title) ASC");
		
		return $query->rows;
	}
}
?>